home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Applications / Graphics / GraphicsWrap / Source / PolyInspector.m < prev    next >
Text File  |  1991-09-18  |  2KB  |  109 lines

  1.  
  2. /* Generated by Interface Builder */
  3.  
  4. #import "PolyInspector.h"
  5. #import "ListMatrix.h"
  6. #import "TGIFCell.h"
  7. #import <appkit/Application.h>
  8. #import <appkit/Matrix.h>
  9. #import <appkit/NXCursor.h>
  10. #import <appkit/ScrollView.h>
  11. #import <appkit/Window.h>
  12. #import <objc/List.h>
  13.  
  14. // import command cell objects
  15. #import "CmdBgcolor.h"
  16. #import "CmdBgnpoly.h"
  17. #import "CmdCircle.h"
  18. #import "CmdComment.h"
  19. #import "CmdDraw.h"
  20. #import "CmdEndpoly.h"
  21. #import "CmdFgcolor.h"
  22. #import "CmdFps.h"
  23. #import "CmdHold.h"
  24. #import "CmdMove.h"
  25. #import "CmdNewframe.h"
  26. #import "CmdVertex.h"
  27.  
  28. #import "AbsPoly.h"
  29.  
  30. @implementation PolyInspector
  31. - displayMatrix:aMatrix
  32. {
  33.   [aMatrix sizeToCells];
  34.   [aMatrix display];
  35.   return self;
  36. }
  37.  
  38. - initMatrix
  39. {
  40.   NXRect aRect, bRect;
  41.   NXSize cellSpacing={0.0,0.0}, cellSize;
  42.   
  43.   [poly_view getFrame:&aRect];
  44.   [ScrollView getContentSize:&(bRect.size) forFrameSize:&(aRect.size)
  45.    horizScroller:YES vertScroller:YES borderType:NX_BEZEL];
  46.   
  47.   poly_matrix = [[ListMatrix alloc] initFrame:&bRect mode:NX_LISTMODE
  48.            cellClass:[TGIFCell class] numRows:0 numCols:1];
  49.   [poly_matrix setIntercell:&cellSpacing];
  50.   [poly_matrix allowEmptySel:YES];
  51.   [poly_matrix setControlDrag:YES];
  52.   
  53.   [poly_matrix getCellSize:&cellSize];
  54.   cellSize.width = NX_WIDTH(&bRect);
  55.   [poly_matrix setCellSize:&cellSize];
  56.   [poly_matrix sizeToCells];
  57.   [poly_matrix setAutosizeCells:YES];
  58.   [poly_matrix setAutoscroll:YES];
  59.   
  60.   [poly_view setDocView:poly_matrix];
  61.   [[poly_matrix superview] setAutoresizeSubviews:YES];
  62.   [poly_matrix setAutosizing:NX_WIDTHSIZABLE];
  63.   
  64.   [poly_matrix setBackgroundGray:NX_LTGRAY];
  65.   [poly_matrix setCellBackgroundGray:NX_LTGRAY];
  66.   [poly_view setBackgroundGray:NX_LTGRAY];
  67.   
  68.   [poly_view setDocCursor:NXArrow];
  69.   [poly_matrix setTarget:self];
  70.   [self displayMatrix:poly_matrix];
  71.   return self;
  72. }
  73.  
  74. - init
  75. {
  76.   [super init];
  77.   [NXApp loadNibSection:"PolyInspector.nib" owner:self withNames:NO];
  78.   [self initMatrix];
  79.   return self;
  80. }
  81.  
  82. - addRowTo:newCell
  83. {
  84.   int rc, cc;
  85.   [poly_matrix getNumRows:&rc numCols:&cc];
  86.   [poly_matrix addRow];
  87.   [poly_matrix putCell:newCell at:rc :0];  
  88.   return self;
  89. }
  90.  
  91. - inspect:aPoly
  92. {
  93.   int rc, cc,i;
  94.   id cellList;
  95.  
  96.   [poly_matrix getNumRows:&rc numCols:&cc];
  97.   for(i=0;i<rc;i++)
  98.     [poly_matrix removeRowAt:0 andFree:NO];
  99.  
  100.   cellList=[aPoly commandList];
  101.   for(i=0;i<[cellList count];i++)
  102.     [self addRowTo:[cellList objectAt:i]];
  103.   [self displayMatrix:poly_matrix];
  104.   return self;
  105. }
  106.  
  107. - window { return poly_window; }
  108. @end
  109.